Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
isource.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Roc authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_sndio/isource.h
10//! @brief Source interface.
11
12#ifndef ROC_SNDIO_ISOURCE_H_
13#define ROC_SNDIO_ISOURCE_H_
14
15#include "roc_audio/frame.h"
16
17namespace roc {
18namespace sndio {
19
20//! Source interface.
21class ISource {
22public:
23 virtual ~ISource();
24
25 //! Get source sample rate.
26 virtual size_t sample_rate() const = 0;
27
28 //! Check if the source has own clock.
29 virtual bool has_clock() const = 0;
30
31 //! Source state.
32 enum State {
33 //! Source is active and is producing some sound.
35
36 //! Source is inactive and is producing silence.
38 };
39
40 //! Get current source state.
41 virtual State state() const = 0;
42
43 //! Wait until the source state becomes active.
44 //! @remarks
45 //! Spurious wakeups are allowed.
46 virtual void wait_active() const = 0;
47
48 //! Read frame.
49 //! @returns
50 //! false if there is nothing to read anymore.
51 virtual bool read(audio::Frame&) = 0;
52};
53
54} // namespace sndio
55} // namespace roc
56
57#endif // ROC_SNDIO_ISOURCE_H_
Audio frame.
Definition: frame.h:22
Source interface.
Definition: isource.h:21
virtual bool read(audio::Frame &)=0
Read frame.
State
Source state.
Definition: isource.h:32
@ Active
Source is active and is producing some sound.
Definition: isource.h:34
@ Inactive
Source is inactive and is producing silence.
Definition: isource.h:37
virtual State state() const =0
Get current source state.
virtual size_t sample_rate() const =0
Get source sample rate.
virtual void wait_active() const =0
Wait until the source state becomes active.
virtual bool has_clock() const =0
Check if the source has own clock.
Audio frame.
Root namespace.